//
//  NewTableViewCell.m
//  New
//
//  Created by dlios on 15-7-17.
//  Copyright (c) 2015年 yangTao. All rights reserved.
//

#import "NewTableViewCell.h"



@implementation NewTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatSubView];
    }

    return self;
    
}

-(void)creatSubView{

   
       self.imageUrl = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 80, 80)];
    self.imageUrl.backgroundColor = [UIColor clearColor];
    [self addSubview:self.imageUrl];
    BaseUiview *view = [[BaseUiview alloc]initWithFrame:CGRectMake(2, 100, self.frame.size.width+100, 1)];
    [self addSubview:view];
    if (WIDTH > 375) {
        self.label = [[BaseLabel alloc]initWithFrame:CGRectMake(100, 10, self.frame.size.width-20 ,80)];
        self.label.backgroundColor = [UIColor clearColor];
        self.label.numberOfLines = 0;
        [self addSubview:self.label];
    }
    
    if (WIDTH == 375) {
        self.label = [[BaseLabel alloc]initWithFrame:CGRectMake(100, 10, self.frame.size.width - 50,80)];
        self.label.backgroundColor = [UIColor clearColor];
        self.label.numberOfLines = 0;
        [self addSubview:self.label];
    }else if(WIDTH < 375)
    
    {
        self.label = [[BaseLabel alloc]initWithFrame:CGRectMake(100, 10, self.frame.size.width -105,80)];
        self.label.backgroundColor = [UIColor clearColor];
        self.label.numberOfLines = 0;
        [self addSubview:self.label];

    
    }
    
}
-(void)setModel:(NewModel *)model{

    if (_model != model) {
        _model = model;
    }
    self.label.text = model.title;

    
        NSURL *url = [NSURL URLWithString:model.imageUrl];
    

    [self.imageUrl sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"FFFD14.png"]];

    
    
    
}


@end
